<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试界面</title>
    <script src="js/jquery-3.1.1.min.js"></script>
</head>
<body>
    <div id="div" style="width: 50px;height: 40px"></div>
    <button onclick="getStr()">查询</button>
</body>
<script>
    function getStr(){
        $.ajax({
            url:"test",
            type:"post",
            data:{},
            dataType:"json",
            success:function(data){
                //请求成功执行
                $("#div").text(data);
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                $("#div").text("发生错误");
            }
        });
    }
</script>
</html>